home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / tlx_sq15.zip / PSHDIR1A.ZIP / POPDIR.LST < prev    next >
File List  |  1988-12-22  |  9KB  |  158 lines

  1. Turbo Assembler  Version 1.0        12-22-88 23:23:29         Page 1
  2. POPDIR.ASM
  3.  
  4.       1                              main    group   code
  5.       2 0000                         code    segment public  para    'code'
  6.       3                              assume  cs:main
  7.       4
  8.       5                              org     100h                            ;.COM file
  9.       6
  10.       7 0100  E9 020E                BEGIN:  jmp     START                   ;program starts here
  11.       8                              ;               db      "Copyright 1986 Ziff-Davis Publishing Co.",1Ah
  12.       9                              ;                       Changes made on 12/22/88 by Mike Williams
  13.      10                              ;                       1. Support command line parm to also CHDIR
  14.      11                              ;                       2. If path string refers to a drive, log that drive
  15.      12                              ;
  16.      13 0103  50 55 53 48 44 49 52 + signature       db      'PUSHDIR VERSION 1.a'
  17.      14       20 56 45 52 53 49 4F +
  18.      15       4E 20 31 2E 61
  19.      16       = 0013                 lengthsignature = $ - signature
  20.      17
  21.      18 0116  ????????               savedint16      dd      ?               ;used to be identical to pushdir
  22.      19
  23.      20 011A  011Cr                  nextpush        dw      offset main:push1dir    ;next place to save a dir
  24.      21 011C  43*(00)                push1dir        db      67 dup (0)
  25.      22 015F  43*(00)                push2dir        db      67 dup (0)
  26.      23 01A2  43*(00)                push3dir        db      67 dup (0)
  27.      24 01E5  43*(00)                push4dir        db      67 dup (0)
  28.      25 0228  43*(00)                push5dir        db      67 dup (0)
  29.      26 026B  43*(00)                push6dir        db      67 dup (0)
  30.      27
  31.      28                              ;up to here must be EXACTLY identical in both PUSHDIR and POPDIR.
  32.      29
  33.      30 02AE  4D 75 73 74 20 72 75 + notinstalled1   db      'Must run PUSHDIR.COM before POPDIR.COM'
  34.      31       6E 20 50 55 53 48 44 +
  35.      32       49 52 2E 43 4F 4D 20 +
  36.      33       62 65 66 6F 72 65 20 +
  37.      34       50 4F 50 44 49 52 2E +
  38.      35       43 4F 4D
  39.      36 02D4  20 77 69 6C 6C 20 64 +                 db      ' will do anything.',13,10,10,'$'
  40.      37       6F 20 61 6E 79 74 68 +
  41.      38       69 6E 67 2E 0D 0A 0A +
  42.      39       24
  43.      40 02EA  45 72 72 6F 72 20 70 + errpop1         db      'Error popping the current directory',13,10,10,'$'
  44.      41       6F 70 70 69 6E 67 20 +
  45.      42       74 68 65 20 63 75 72 +
  46.      43       72 65 6E 74 20 64 69 +
  47.      44       72 65 63 74 6F 72 79 +
  48.      45       0D 0A 0A 24
  49.      46
  50.      47 0311                         START:
  51.      48 0311  FB                             sti                             ;interrupts on
  52.      49
  53.      50                                      ;is PUSHDIR already installed ?
  54.      51
  55.      52 0312  B8 7788                        mov     ax,7788h                        ;signature request
  56.      53 0315  BB 7789                        mov     bx,7789h                        ;signature request
  57.      54 0318  BE 0103r                       mov     si,offset main:signature        ;point ds:si to signature
  58.      55 031B  CD 16                          int     16h                     ;is it installed ?
  59.      56
  60.      57                              assume  ds:nothing
  61.      58
  62.      59 031D  81 FB 7788                     cmp     bx,7788h                        ;were ax and bx switched ?
  63. Turbo Assembler  Version 1.0        12-22-88 23:23:29         Page 2
  64. POPDIR.ASM
  65.  
  66.      60 0321  75 07                          jne     NOTINSTALLED            ;no
  67.      61 0323  3D 7789                        cmp     ax,7789h                        ;were ax and bx switched ?
  68.      62 0326  75 02                          jne     NOTINSTALLED            ;no
  69.      63 0328  EB 09                          jmp     short ISINSTALLED               ;yes - continue, no error
  70.      64 032A                         NOTINSTALLED:
  71.      65
  72.      66                                      ;here PUSHDIR was not previously installed so POPDIR can't do anything
  73.      67                                      ;useful so we just terminate with an error message.
  74.      68
  75.      69 032A  BA 02AEr                       mov     dx,offset main:notinstalled1    ;error message
  76.      70 032D  B4 09                          mov     ah,9
  77.      71 032F  CD 21                          int     21h
  78.      72 0331  CD 20                          int     20h                     ;exit
  79.      73
  80.      74
  81.      75 0333                         ISINSTALLED:
  82.      76
  83.      77                                      ;get the address of the directory previously saved by pushdir
  84.      78
  85.      79 0333  8B 2E 011Ar                    mov     bp,ds:[nextpush]                ;get the next push location
  86.      80 0337  83 ED 43                       sub     bp,67                           ;back up one to the last push
  87.      81 033A  81 3E 011Ar 011Cr              cmp     ds:[nextpush],offset main:push1dir      ;need to wrap back ?
  88.      82 0340  75 03                          jne     NOWRAPBACK                      ;no
  89.      83 0342  BD 026Br                       mov     bp,offset main:push6dir         ;yes, wrap back
  90.      84 0345                         NOWRAPBACK:
  91.      85
  92.      86                                      ;set the current directory
  93.      87
  94.      88 0345  8B D5                          mov     dx,bp                   ;load ds:dx with directory to set
  95.      89 0347  B4 3B                          mov     ah,3bh                  ;dos function number
  96.      90 0349  CD 21                          int     21h                     ;set current dir back
  97.      91 034B  72 11                          jc      ERRPOP                  ;branch on error
  98.      92 034D  89 2E 011Ar                    mov     ds:[nextpush],bp        ;update [nextpush] if successful
  99.      93
  100.      94                                      ;set the current drive also
  101.      95
  102.      96 0351  3E: 8A 56 00                   mov     dl,ds:[bp]                      ;get drive letter from path
  103.      97 0355  80 EA 41                       sub     dl,'A'                          ;convert to binary (0=A, 1=B)
  104.      98 0358  B4 0E                          mov     ah,0eh                          ;dos function number
  105.      99 035A  CD 21                          int     21h                             ;set drive
  106.     100
  107.     101                                      ;exit successfully with no message
  108.     102
  109.     103 035C  CD 20                          int     20h                             ;exit
  110.     104
  111.     105 035E                         ERRPOP:
  112.     106 035E  0E                             push    cs
  113.     107 035F  1F                             pop     ds                              ;set ds = cs
  114.     108 0360  BA 02EAr                       mov     dx,offset main:errpop1          ;error message
  115.     109 0363  B4 09                          mov     ah,9                            ;dos function number
  116.     110 0365  CD 21                          int     21h                             ;show the message
  117.     111 0367  CD 20                          int     20h                             ;terminate
  118.     112
  119.     113 0369                         code    ends
  120.     114                              end     BEGIN                           ;start execution at BEGIN
  121. Turbo Assembler  Version 1.0        12-22-88 23:23:29         Page 3
  122. Symbol Table
  123.  
  124.  
  125. Symbol Name                       Type   Value
  126.  
  127. ??DATE                            Text   "12-22-88"
  128. ??FILENAME                        Text   "POPDIR  "
  129. ??TIME                            Text   "23:23:29"
  130. ??VERSION                         Number 0100
  131. @CPU                              Text   0101H
  132. @CURSEG                           Text   CODE
  133. @FILENAME                         Text   POPDIR
  134. @WORDSIZE                         Text   2
  135. BEGIN                             Near   CODE:0100
  136. ERRPOP                            Near   CODE:035E
  137. ERRPOP1